<!--
 * @company : 版权所属 四川北星惯牌科技有限公司
 * @contact : 刘经理 19326416371
 -->
<template>
	<view class="storeItem w100 flex" @click="toStoreDetails">
		<view class="store-left">
			<image :src="shopInfo.background_image" class="img" mode="aspectFill"></image>
		</view>
		<view class="store-right flex">
			<view class="flex store-top">
				<text class="name">{{shopInfo.store_name}}</text>
				<view class="address-box flex">
					<view class="icon">
						<up-icon name="map-fill" color="#A5A6A7" size="28rpx"></up-icon>
					</view>
					<text class="address">{{shopInfo.address}}</text>
				</view>
			</view>
			<view class="btn-box flex-center">
				<text class="text">查看详情</text>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		userInfoStore
	} from '@/stores/user';
	const userStore = userInfoStore();
	const props = defineProps({
		shopInfo: {
			default: {}
		}
	});
	const shopInfo = computed(() => props.shopInfo);
	const toStoreDetails = () => {
		uni.navigateTo({
			url: '/page_store/views/storeDetails?storeId=' + shopInfo.value.id
		})
	}
</script>

<style lang="scss" scoped>
	.storeItem {
		padding: 20rpx;
		border-radius: 18rpx;
		background-color: $item-background-color;
		margin-bottom: 24rpx;

		.store-left {
			.img {
				width: 224rpx;
				height: 224rpx;
				border-radius: 12rpx;
			}
		}

		.store-right {
			flex: 1;
			margin-left: 18rpx;
			overflow: hidden;
			flex-direction: column;
			justify-content: space-between;

			.store-top {
				flex-direction: column;
			}

			.name {
				color: $name-color;
				font-size: 36rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				word-break: break-all;
				-webkit-box-orient: vertical;
			}

			.address-box {
				width: 100%;
				margin-top: 18rpx;
				display: flex;
				align-items: flex-start;
				.icon{
					margin-top: 8rpx;
				}
			}

			.address {
				display: block;
				color: $description-color;
				font-size: 28rpx;
				margin-left: 12rpx;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				word-break: break-all;
				overflow: hidden;
				-webkit-box-orient: vertical;
			}

			.btn-box {
				height: 64rpx;
				width: 180rpx;
				background: $btn-bg-color;
				border-radius: 32rpx;
				align-self: flex-end;
				margin-top: 18rpx;

				.text {
					font-size: 28rpx;
					color: $btn-text-color;
				}
			}
		}
	}
</style>